package com.haiyou.common.base;

import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.util.List;

/**
 * 抽象类实现基础操作数据库接口方法
 *
 * @author root
 * @date 2019-03-09 18:49:01
 */
public abstract class AbstractBaseService<M extends BaseMapper<T>, T extends Serializable> implements BaseService<T> {

    @Autowired
    protected M mapper;

    @Override
    public int insert(T t) {
        return this.mapper.insert(t);
    }

    @Override
    public int insertSelective(T t) {
        return this.mapper.insertSelective(t);
    }

    @Override
    public int insertList(List<T> t) {
        return this.mapper.insertList(t);
    }

    @Override
    public int delete(T t) {
        return mapper.delete(t);
    }

    @Override
    public int deleteByExample(Object o) {
        return this.mapper.deleteByExample(o);
    }

    @Override
    public int deleteByPrimaryKey(Object o) {
        return this.mapper.deleteByPrimaryKey(o);
    }

    @Override
    public int updateByPrimaryKey(T t) {
        return this.mapper.updateByPrimaryKey(t);
    }

    @Override
    public int updateByExample(T t, Object o) {
        return this.mapper.updateByExample(t, o);
    }

    @Override
    public int updateByExampleSelective(T t, Object o) {
        return this.mapper.updateByExampleSelective(t, o);
    }

    @Override
    public int updateByPrimaryKeySelective(T t) {
        return this.mapper.updateByPrimaryKeySelective(t);
    }

    @Override
    public List<T> select(T t) {
        return this.mapper.select(t);
    }

    @Override
    public List<T> selectAll() {
        return this.mapper.selectAll();
    }

    @Override
    public List<T> selectByExample(Object o) {
        return this.mapper.selectByExample(o);
    }

    @Override
    public List<T> selectByExampleAndRowBounds(Object o, RowBounds rowBounds) {
        return this.mapper.selectByExampleAndRowBounds(o, rowBounds);
    }

    @Override
    public T selectByPrimaryKey(Object o) {
        return this.mapper.selectByPrimaryKey(o);
    }

    @Override
    public List<T> selectByRowBounds(T t, RowBounds rowBounds) {
        return this.mapper.selectByRowBounds(t, rowBounds);
    }

    @Override
    public int selectCount(T t) {
        return this.mapper.selectCount(t);
    }

    @Override
    public int selectCountByExample(Object o) {
        return this.mapper.selectCountByExample(o);
    }

    @Override
    public T selectOne(T t) {
        return this.mapper.selectOne(t);
    }

    @Override
    public T selectOneByExample(Object o) {
        return this.mapper.selectOneByExample(o);
    }

    @Override
    public boolean existsWithPrimaryKey(Object o) {
        return this.mapper.existsWithPrimaryKey(o);
    }
}
